widget: Use an unchecked cast in _get_native()
authorTimm Bäder <mail@baedert.org>
Wed, 29 Apr 2020 06:07:45 +0000 (08:07 +0200)
committerTimm Bäder <mail@baedert.org>
Tue, 5 May 2020 06:20:10 +0000 (08:20 +0200)
This is either no chagne because we know for a fact that the returned
value is a GtkNative - after all thats's the type we pass to
gtk_widget_get_ancestor().

Or it is a bug fix since casting NULL to a GtkNative using GTK_NATIVE()
is not going to work, but the API contract of gtk_widget_get_native()
explicitly allows a NULL return value.

gtk/gtkwidget.c

index 463d1319e787aa34c6723bb1f0f1ebb3eafa0c92..c5dca9447d66867762f714a9241435580dbe1b6b 100644 (file)
@@ -6053,7 +6053,7 @@ gtk_widget_get_native (GtkWidget *widget)
 {
   g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
 
-  return GTK_NATIVE (gtk_widget_get_ancestor (widget, GTK_TYPE_NATIVE));
+  return (GtkNative *)gtk_widget_get_ancestor (widget, GTK_TYPE_NATIVE);
 }
 
 static void